]> snippets.scripts.mit.edu Git - Scripts/git/.git/blobdiff - sipbmp3-itunes/Send to sipbmp3.applescript
Instead of looping over the lpr commands within applescript, use a
[Scripts/git/.git] / sipbmp3-itunes / Send to sipbmp3.applescript
index ebf6e1f4557de9f52bc9c5d1dc0e463aea7c415b..2a0a707171644b1269b8dd7e1b305de8237582f6 100644 (file)
@@ -7,6 +7,8 @@
 --
 -- Changelog:
 --
+-- 23 Aug 2009 -> broder spun loop into shell script instead of
+--     applescript so that iTunes doesn't hang
 -- 9 Jan 2009 -> price added 'quoted form'
 -- 7 Jan 2009 -> kmill created initial version
 --
 -- feedback beyond the pleasant sounds you now
 -- hear around you.
 
-set lista to {}
+set ts to ""
 
 tell application "iTunes"
        repeat with t in selection
                if class of t is (file track) then
                        set loc to POSIX path of (get location of t)
-                       set end of lista to "lpr -o raw -Psipbmp3 " & (quoted form of loc)
+                       set ts to ts & " " & (quoted form of loc)
                end if
        end repeat
 end tell
 
-repeat with com in lista
-       do shell script com
-end repeat
\ No newline at end of file
+set command to "(for t in " & ts & "; do lpr -o raw -Psipbmp3 \"$t\"; done) >/dev/null 2>&1 </dev/null &"
+do shell script command